package com.wl.designpattern.factory.jdgc;

/**
 * 创建工厂类，创建具体的产品
 * Created by wangliang on 2021/2/27.
 */
public class Factory {
    public static Product create(String productName) {
        Product product = null;
        //通过switch语句控制生产哪种商品
        switch (productName) {
            case "A":
                product = new ProductA();
                break;
            case "B":
                product = new ProductB();
                break;
        }
        return product;
    }
}
